<?php
/*
 * Copyright (c) 2021.  Liuhongbin All rights reserved.
 * @domain http://dkyx.cc
 * @author liuhongbin <514660094@qq.com>
 */

namespace app\adminapi\controller\v1\system;

use app\common\controller\AdminController;

//AccessKey ID：
//LTAI5tHzNis1mebYTqza8nHU
//AccessKey Secret：
//NHvfXAQ4WmVTUtB4t7qTfTVVUNbMAk

use Overtrue\EasySms\EasySms;
use Overtrue\EasySms\Strategies\OrderStrategy;

class Sms extends AdminController
{
    protected $notLogin = "*";

//    public $config = [
//        // HTTP 请求的超时时间（秒）
//        'timeout'  => 5.0,
//
//        // 默认发送配置
//        'default'  => [
//            // 网关调用策略，默认：顺序调用
//            'strategy' => OrderStrategy::class,
//
//            // 默认可用的发送网关
//            'gateways' => [
//                'aliyun',
//            ],
//        ],
//        // 可用的网关配置
//        'gateways' => [
//            'errorlog' => [
//                'file' => '/tmp/easy-sms.log',
//            ],
//            'aliyun'   => [
//                'access_key_id'     => 'LTAI5tHzNis1mebYTqza8nHU',
//                'access_key_secret' => 'NHvfXAQ4WmVTUtB4t7qTfTVVUNbMAk',
//                'sign_name'         => '嘿多客',
//            ],
//        ]
//    ];
//
    public function test()
    {
        $easySms = new EasySms($this->config);
        $res = $easySms->send(15002831754, [
            "content"  => "您的兑换申请已经通过，兑换码为5201314，请勿告诉别人！",
            "template" => "SMS_225386739",
            "data"     => [
                'code' => '5201314'
            ]
        ]);
        dump($res);
    }
    public function index(){

    }
}
